package com.jeeos.modules.system.user.controller;

import com.jeeos.framework.api.Result;
import com.jeeos.modules.system.user.domain.SysUser;
import com.jeeos.modules.system.user.service.SysUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class SystemUserController {

    private final static Logger logger = LoggerFactory.getLogger(SystemUserController.class);

    @Autowired
    SysUserService sysUserService;
    /*
     * 根据用户名登陆
     */
    @GetMapping("/user/getUserByLoginName")
    public Result getUserByLoginName(String loginName){
        SysUser userByLoginName = sysUserService.getUserByLoginName(loginName);
        return Result.success(userByLoginName);
    }
    /*
     * 根据用户名登陆
     */
    @GetMapping("/user/getUserByEmail")
    public Result getUserByEmail(String email){
        SysUser userByEmail = sysUserService.getUserByEmail(email);
        return Result.success(userByEmail);
    }/*
     * 根据用户名登陆
     */
    @GetMapping("/user/getUserByLogin")
    public Result postAccessToken(String phoneNumber){
        SysUser userByPhoneNumber = sysUserService.getUserByPhoneNumber(phoneNumber);
        return Result.success(userByPhoneNumber);
    }
}
